/*
 * TileSet.h
 *
 *  Created on: Aug 25, 2011
 *      Author: mengwei.chua
 */

#ifndef TILESET_H_
#define TILESET_H_

#include <string>
#include <deque>

#include "util/IXmlParsable.h"
#include "Image.h"
#include "Properties.h"

namespace projectcos
{
namespace tile
{
namespace parser
{

class TileSet : public projectcos::util::IXmlParsable
{
public:
	class Tile : public projectcos::util::IXmlParsable
	{
	public:
		Tile();
		virtual ~Tile();

		virtual bool Parse(const TiXmlElement* element);

		void GetProperties(Properties& properties) const;
		void GetImages(std::deque<Image>& images) const;

	protected:
	private:
		unsigned int m_ID;

		Properties m_Properties;
		std::deque<Image> m_ImageList;
	};


	TileSet();
	virtual ~TileSet();

	virtual bool Parse(const TiXmlElement* element);

	unsigned int GetFirstGID() const;
	std::string GetSource() const;
	std::string GetName() const;
	unsigned int GetTileWidth() const;
	unsigned int GetTileHeight() const;
	unsigned int GetSpacing() const;
	unsigned int GetMargin() const;
	void GetImages(std::deque<Image>& images) const;
	void GetTiles(std::deque<Tile>& tiles) const;

protected:
private:
	unsigned int m_FirstGID;
	std::string m_Source;
	std::string m_Name;
	unsigned int m_TileWidth;
	unsigned int m_TileHeight;
	unsigned int m_Spacing;
	unsigned int m_Margin;

	std::deque<Image> m_ImageList;
	std::deque<Tile> m_TileList;
};

} // parser
} // tile
} // projectcos

#endif /* TILESET_H_ */
